// https://www.luogu.com.cn/problem/P3808
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
using ll = long long;
const int inf = 0x3f3f3f3f;
#define rf(i, n) for (int i = 1; i <= (n); ++i)
int rad(); // read int
const int max_size = 5 + 1e6;
const int maxn = 5 + 1e6;

int n;
char row[max_size];
char str[max_size];

int tot;
int trans[max_size][26]; // tans[u][i] = v 表示从 u 经过边 i 能到达 v，状态转移
int fail[max_size];      // 失配指针，本质上指向后缀相同的字符串
int cnt[max_size];       // 以该节点结尾的字符串数量
int last[max_size];      // 跳转位置
bool visit[max_size];    // 是否查询到
// int index[max_size];     // 以该节点结尾的字符串是第几个模式串

void init() {
    tot = 0;
    memset(trans, 0, sizeof(trans));
    memset(fail, 0, sizeof(fail));
    memset(cnt, 0, sizeof(cnt));
    memset(last, 0, sizeof(last));
    memset(visit, 0, sizeof(visit));
    // memset(index, 0, sizeof(index));
}

void insert(char *s, int id = 0) { // 字典树插入
    int u = 0;
    for (int i = 0, ed = strlen(s); i < ed; ++i) {
        int &v = trans[u][s[i] - 'a'];
        if (v == 0) v = ++tot;
        u = v;
    }
    ++cnt[u];
    // index[u] = id;
}

void build() { // 建立 ac 自动机
    queue<int> qe;
    for (int i = 0; i < 26; ++i) {
        if (trans[0][i] == 0) continue;
        int &v = trans[0][i];
        fail[v] = 0;
        last[v] = 0;
        qe.push(v);
    }
    while (!qe.empty()) {
        int u = qe.front();
        qe.pop();
        for (int i = 0; i < 26; ++i) {
            if (trans[u][i] == 0) continue;
            int v = trans[u][i], p = fail[u];
            while (p > 0 && trans[p][i] == 0) // 匹配失败，指针不断倒退
                p = fail[p];
            fail[v] = trans[p][i];
            last[v] = (cnt[fail[v]] ? fail[v] : last[fail[v]]); // 路径压缩
            qe.push(v);
        }
    }
}

void ask(char *s) { // 查询 s 中，出现的模式串种数
    int u = 0;
    for (int i = 0, ed = strlen(s); i < ed; ++i) {
        int c = s[i] - 'a';
        while (u > 0 && trans[u][c] == 0)
            u = fail[u];
        u = trans[u][c];
        for (int v = u; v > 0; v = last[v]) {
            visit[v] = 1; // 访问 fail 路径
        }
    }
}

int main() {
    n = rad();
    init();
    rf(i, n) {
        scanf("%s", row);
        insert(row);
    }
    build();
    scanf("%s", str);
    ask(str);
    int ans = 0;
    for (int i = 1; i <= tot; ++i)
        if (visit[i]) ans += cnt[i];
    printf("%d\n", ans);
}
int rad() {
    int back = 0, ch = 0, posi = 0;
    for (; ch < '0' || ch > '9'; ch = getchar())
        posi = ch ^ '-';
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        back = (back << 1) + (back << 3) + (ch & 0xf);
    return posi ? back : -back;
}

/*
1
5
she
he
say
shr
her
yasherhs

*/